/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.wcalendar.business.security.boundary;

import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import it.polimi.wcalendar.business.security.entity.District;

/**
 *
 * @author baldo
 */
public class EventManager {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("authPU");
        @PersistenceContext
        EntityManager em = emf.createEntityManager();
        
    /**
     *
     * @param id
     * @return
     */
    public List getByDistrict(District id){
            Query createNamedQuery = em.createNamedQuery("Event.findByDistrict");
            createNamedQuery.setParameter("place",id);
            List list = createNamedQuery.getResultList();
            return list;
        }
    
}
